#ifndef __FileSystem_h__
#define __FileSystem_h__

#include "Base/Types.h"

struct BFile;

struct FileHandle
{
    struct BFile * pFile;
    SizeType iCurPos;
};

typedef enum FileMode
{
	FM_OpenRead = 1, 
	FM_OpenWrite = 2, 
	FM_OpenRW = 3, 
	FM_Create = 4
} FileModes;

void FileSystem_Init();
void FileSystem_Free();
bool Open(FileHandle * file, const char * filePath, int modes);
void Close(FileHandle * file);

SSizeType Read(FileHandle * file, void * data, SizeType len);
SSizeType Write(FileHandle * file, const void * data, SizeType len);
SSizeType PRead(FileHandle * file, void * data, SizeType len, SizeType offset);
SSizeType PWrite(FileHandle * file, const void * data, SizeType len, SizeType offset);

bool Truncate(FileHandle * file, SizeType size);
SizeType Seek(FileHandle * file, SSizeType offset, int whence);

#endif

